package com.jwdf.uda.http.action;

import android.content.Context;

import com.jwdf.uda.bean.PbBean;
import com.jwdf.uda.http.AHttpService;
import com.jwdf.uda.http.ApiService;

import java.util.List;

import retrofit2.Call;

/**
 * 类说明：
 * 作者：huangqiuxin on 2016/5/14 14:27
 * 邮箱：648859026@qq.com
 */
public class GuideAddCommentAction extends AHttpService<PbBean.PbResCommentAddComment>{
    /**
     * 搭配指导添加评论
     * @param context
     * @param id 指导ID
     * @param content 内容
     * @param atCommentId 评论的评论ID
     * @return
     */
    public static GuideAddCommentAction newInstance(Context context, int id, String content,int atCommentId, List<String> imageTokenList, PbBean.PbSignNavType navType){
        return new GuideAddCommentAction(context, id, content, atCommentId, imageTokenList,navType);
    }
    private int id;
    private String content;
    private int atCommentId;
    private  List<String> imageTokenList;
    private PbBean.PbSignNavType navType;
    private GuideAddCommentAction(Context context, int id, String content,int atCommentId,  List<String> imageTokenList, PbBean.PbSignNavType navType) {
        super(context);
        this.id = id;
        this.content = content;
        this.atCommentId = atCommentId;
        this.imageTokenList = imageTokenList;
        this.navType=navType;
    }

    @Override
    protected Call newRetrofitCall(ApiService apiService, PbBean.PbBaseClientInfo.Builder baseBuilder) {
        PbBean.PbReqCommentAddComment.Builder builder = PbBean.PbReqCommentAddComment.newBuilder();
        builder.setBaseClientInfo(baseBuilder);
        builder.setDetailId(id);
        builder.setContent(content);
        builder.setAtCommentId(atCommentId);
        builder.setType(navType);
        if(imageTokenList != null){
            builder.addAllImageTokenList(imageTokenList);
        }

        return apiService.replyAddComment(builder.build());
    }
}
